<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>两面翻转的盒子案例</title>
    <style>
        body {
            perspective: 400px;
        }
        
        .box {
            width: 200px;
            height: 200px;
            position: relative;
            transition: all 1s;
            margin: 100px auto;
            /* border: 1px solid #222; */
            transform-style: preserve-3d;
        }
        
        .box:hover {
            transform: rotateY(180deg);
        }
        
        .box div {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            position: absolute;
            font-size: 30px;
            line-height: 200px;
            color: white;
            text-align: center;
            backface-visibility: hidden;
        }
        
        .front {
            background-color: pink;
            /* backface-visibility 指定当元素背面朝向观察者时是否可见。 */
            backface-visibility: hidden;
        }
        
        .back {
            background-color: skyblue;
            transform: rotateY(180deg);
        }
    </style>
</head>

<body>


</body>
<div class="box">
    <div class="back">贪吃蛇</div>
    <div class="front">球球大作战</div>
</div>

</html>